<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
<script>
    // 全局配置URL
    // 配置基本URL
    axios.defaults.baseURL = "http://s.linweiqin.com";
    // 请求的拦截器
    axios.interceptors.request.use(
        function (config) {
            console.log("拦截器：请求之前 config",config);
            if(config.data){
                config.data["token"] = "jfopdsjfsd;fj";
            }
            return config;
        },
        function (error) {
            return Promise.reject(error);
        }
    );
    axios.interceptors.response.use(
        function(response){
            return response.data;
        },
        function (error) {
            return Promise.reject(error);
        }
    );
    axios.post("http://s.linweiqin.com/api/s/getIndexLoopimg",{
        name:"thomaslwq"
    }).then((res)=>{
        console.log(res);
    }).catch(err=>{
        console.log(err);
    })

</script>
</html>